// hooks 是一个函数
import { reactive, onMounted, onUnmounted } from 'vue'
const getpoint = () => {
    // 01: 定义变量, 包括x y 左边
    let point = reactive({
        x: 0,
        y: 0,
    });
    // 02: 在生命周期函数中给document对象绑定点击事件
    onMounted(() => {
        document.onclick = (event) => {
            // console.log(event.pageX, event.pageY);
            point.x = event.pageX;
            point.y = event.pageY;
        };
    });

    onUnmounted(() => {
        document.onclick = null;
    });

    return point

}

export default getpoint